<?php
session_start();
$_SESSION['userid']=isset($_SESSION['userid'])?$_SESSION['userid']:'';
if(!$_SESSION['userid'])
{
    echo "<script>location='login.php'</script>";
    exit;
}
?>